import random

def shellsort(A):
	N = len(A)
	flag = True

	while flag and N > 1:
		flag = False
		N = (N + 1) / 2
		for k in range(0, len(A) - N):
			if A[k + N] < A[k]:
				A[N + k], A[k] = A[k], A[N + k]
				flag = True
	return A



A = [random.randint(1, 20) for k in range(20)]
print shellsort(A)